<template>
    <div class="collect-page">
        <van-nav-bar
            title="收藏"
        />

        <van-list
            v-model="loading"
            :finished="finished"
            finished-text="没有更多了"
            @load="onLoad"
        >
            <article-item :dataList="dataList"></article-item>
        </van-list>
    </div>
</template>

<script>
import { getFlagList } from '@/api/like_collect'

export default {
    name: 'CollectPage',
    data () {
        return {
            dataList: [],
            loading: false,
            finished: false,
            page: 1,
            pageSize: 10
        }
    },
    methods: {
        async onLoad () {
            const res = await getFlagList({
                page: this.page,
                pageSize: this.pageSize,
                optType: 2,
            })
            this.dataList = this.dataList.concat(res.data.data.rows)
            this.page++
            this.loading = false
            if (this.page > res.data.data.pageTotal) this.finished = true
        },
    }
}
</script>

<style lang="less" scoped>

</style>
